Dit voorbeeld maakt gebruik van de instructie Static om de waarde van een variabele vast te houden zolang de programmacode wordt uitgevoerd.
' Functiedefinitie.
Function KeepTotal(Number)
' Only the variable Accumulate preserves its value between calls.
Static Accumulate
Accumulate = Accumulate + Number
KeepTotal = Accumulate
End Function
' Static functiedefinitie.
Static Function MyFunction(Arg1, Arg2, Arg3)
' All local variables preserve value between function calls.
Accumulate = Arg1 + Arg2 + Arg3
Half = Accumulate / 2
MyFunction = Half
End Function